﻿Public Class NhaCungCapDAO
    Public Shared Sub insert(ByVal NhaCungCap As NhaCungCapDTO)
        Dim strSQL As String
        strSQL = "insert into NHACUNGCAP(MANHACUNGCAP,TENNHACUNGCAP) Values('" & NhaCungCap.MaNhaCungCap & "','" & NhaCungCap.TenNhaCungCap & "')"
        SQLProvider.ExecNoneQuery(strSQL)
    End Sub
    Public Shared Function selectALL() As DataTable
        Dim strSQL As String
        strSQL = "select * from NHACUNGCAP"

        Dim dt As DataTable
        dt = SQLProvider.ExecQuery(strSQL)
        Return dt
    End Function
    Public Shared Sub delete(ByVal MaNhaCungCap As String)
        Dim strSQL As String
        strSQL = "delete from NHACUNGCAP where MANHACUNGCAP = '" & MaNhaCungCap & "'"
        SQLProvider.ExecNoneQuery(strSQL)
    End Sub
    Public Shared Sub Update(ByVal NhaCungCap As NhaCungCapDTO)
        Dim strSQL As String = "Update NHACUNGCAP set TENNHACUNGCAP = '" & NhaCungCap.TenNhaCungCap & "' where MANHACUNGCAP = '" & NhaCungCap.MaNhaCungCap & "'"
        SQLProvider.ExecNoneQuery(strSQL)
    End Sub
    Public Shared Function TimKiemNhaCungCapTen(ByVal Tenkh As String) As DataTable
        Dim strsql As String
        strsql = "SELECT * FROM NHACUNGCAP WHERE TENNHACUNGCAP LIKE '" & Tenkh & "%'"
        Dim dt As DataTable
        dt = SQLProvider.ExecQuery(strsql)
        Return dt
    End Function
    Public Shared Function TimKiemNhaCungCapMa(ByVal MaKh As String) As DataTable
        Dim strsql As String
        strsql = "SELECT * FROM NHACUNGCAP WHERE MANHACUNGCAP = '" & MaKh & "'"
        Dim dt As DataTable
        dt = SQLProvider.ExecQuery(strsql)
        Return dt
    End Function
End Class
